package ds.factcom.controller.product;

import java.util.List;
import java.util.Observer;

import ds.factcom.domain.product.Product;
import ds.factcom.exception.ExistDomainException;
import ds.factcom.exception.IsProductInInvoicesException;
import ds.factcom.exception.NotExistDomainException;
import ds.factcom.model.ProductModel;

/**
 * 
 * @author Javier De Luca, Maximiliano Herrera, Matias Samblancat
 * 
 */

public class ProductController implements IProductController{
	
	private final ProductModel productModel;
	
	//Constructor
	public ProductController(ProductModel productModel){
		this.productModel = productModel;
	}

	public void delete(String description) throws NotExistDomainException, IsProductInInvoicesException {
		this.productModel.delete(description);
	}
	
	public void insert(String description, Float price )throws ExistDomainException {
		this.productModel.insert(description, price);
	}

	public void findByDescription(String description) throws NotExistDomainException {
		this.productModel.findByDescription(description);
	}

	public void addObserver(Observer observer) {
		this.productModel.addObserver(observer);
	}

	public String getPrice() {
		return this.productModel.getPrice();
	}

	public void modify(Float price) {
		this.productModel.modify(price);
	}
	public Product getProduct() {
		return this.productModel.getProduct();
	}
	public List<Product> getProductList(){
		return this.productModel.getProductList();
	}

	public void setProduct(Product product) {
		this.productModel.setProduct(product);
	}
}